home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / Source / Chapter 10 / Engine / SpawnerObject.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-10-01  |  1.6 KB  |  40 lines

  1. //-----------------------------------------------------------------------------
  2. // A derived scene object for supporting spawner objects. A spawner is an
  3. // object that spawns other objects into the scene.
  4. //
  5. // Programming a Multiplayer First Person Shooter in DirectX
  6. // Copyright (c) 2004 Vaughan Young
  7. //-----------------------------------------------------------------------------
  8. #ifndef SPAWNER_OBJECT_H
  9. #define SPAWNER_OBJECT_H
  10.  
  11. //-----------------------------------------------------------------------------
  12. // Spawner Object Type Define
  13. //-----------------------------------------------------------------------------
  14. #define TYPE_SPAWNER_OBJECT 2
  15.  
  16. //-----------------------------------------------------------------------------
  17. // Spawner Object Class
  18. //-----------------------------------------------------------------------------
  19. class SpawnerObject : public SceneObject
  20. {
  21. public:
  22.     SpawnerObject( char *name, char *path = "./", unsigned long type = TYPE_SPAWNER_OBJECT );
  23.     virtual ~SpawnerObject();
  24.  
  25.     virtual void Update( float elapsed, bool addVelocity = true );
  26.  
  27.     virtual void CollisionOccurred( SceneObject *object, unsigned long collisionStamp );
  28.  
  29.     Script *GetObjectScript();
  30.  
  31. private:
  32.     char *m_name; // Name of the object that is spawned at this spawner.
  33.     float m_frequency; // How often the spawner spawns its object (in seconds).
  34.     float m_spawnTimer; // Timer used for spawning the object.
  35.     Sound *m_sound; // Sound to play when the object is collected.
  36.     AudioPath3D *m_audioPath; // Audio path to play the sound on.
  37.     Script *m_objectScript; // Script for the spawner's object.
  38. };
  39.  
  40. #endif